import { S } from '../../s';
import { IPSAppCodeList } from '../../app/codelist/ipsapp-code-list';
import { PSControlItemImpl2 } from '../pscontrol-item-impl2';
import { IPSChartCoordinateSystem } from './ipschart-coordinate-system';
import { IPSChartDataSet } from './ipschart-data-set';
import { IPSChartSeriesEncode } from './ipschart-series-encode';
import { IPSDEChart } from './ipsdechart';
import { IPSDEChartSeries } from './ipsdechart-series';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';

export class PSDEChartSeriesImpl
  extends PSControlItemImpl2
  implements IPSDEChartSeries
{
  get baseOptionJOString(): string {
    return this.M.baseOptionJOString;
  }

  protected cappslanguageres: IPSLanguageRes;
  getCapPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.cappslanguageres ||
      (this.cappslanguageres = this.fillObjectModel(
        S._276,
        this.M.getCapPSLanguageRes,
        S._2a8,
      ) as IPSLanguageRes)
    );
  }

  get caption(): string {
    return this.M.caption;
  }

  get catalogField(): string {
    return this.M.catalogField;
  }

  protected catalogpscodelist: IPSAppCodeList;
  getCatalogPSCodeList(): IPSAppCodeList | null {
    return (
      this.catalogpscodelist ||
      (this.catalogpscodelist = this.fillObjectModel(
        S._8,
        this.M.getCatalogPSCodeList,
        S._310,
      ) as IPSAppCodeList)
    );
  }

  get dataField(): string {
    return this.M.dataField;
  }

  get eChartsType():
    | 'area'
    | 'bar'
    | 'bar3d'
    | 'candlestick'
    | 'gauge'
    | 'line'
    | 'pie'
    | 'pie3d'
    | 'radar'
    | 'scatter'
    | 'column'
    | 'funnel'
    | 'map'
    | 'custom' {
    return this.M.eChartsType;
  }

  get extValue2Field(): string {
    return this.M.extValue2Field;
  }

  get extValue3Field(): string {
    return this.M.extValue3Field;
  }

  get extValue4Field(): string {
    return this.M.extValue4Field;
  }

  get extValueField(): string {
    return this.M.extValueField;
  }

  get groupMode():
    | 'YEAR'
    | 'QUARTER'
    | 'MONTH'
    | 'YEARWEEK'
    | 'DAY'
    | 'CODELIST' {
    return this.M.groupMode;
  }

  get idField(): string {
    return this.M.idField;
  }

  protected pschartcoordinatesystem: IPSChartCoordinateSystem;
  getPSChartCoordinateSystem(): IPSChartCoordinateSystem | null {
    if (this.pschartcoordinatesystem != null)
      return this.pschartcoordinatesystem;
    const value = this.M.getPSChartCoordinateSystem;
    if (value == null) {
      return;
    }
    const ipsdechart = this.getParentPSModelObject(S._253) as IPSDEChart;
    if (ipsdechart != null) {
      this.pschartcoordinatesystem =
        ipsdechart.findPSChartCoordinateSystem(value);
    }
    return this.pschartcoordinatesystem;
  }

  protected pschartdataset: IPSChartDataSet;
  getPSChartDataSet(): IPSChartDataSet | null {
    if (this.pschartdataset != null) return this.pschartdataset;
    const value = this.M.getPSChartDataSet;
    if (value == null) {
      return;
    }
    const ipsdechart = this.getParentPSModelObject(S._253) as IPSDEChart;
    if (ipsdechart != null) {
      this.pschartdataset = ipsdechart.findPSChartDataSet(value);
    }
    return this.pschartdataset;
  }

  protected pschartseriesencode: IPSChartSeriesEncode;
  getPSChartSeriesEncode(): IPSChartSeriesEncode | null {
    return (
      this.pschartseriesencode ||
      (this.pschartseriesencode = this.fillObjectModel(
        S._10b,
        this.M.getPSChartSeriesEncode,
        S._312,
      ) as IPSChartSeriesEncode)
    );
  }

  protected pssyspfplugin: IPSSysPFPlugin;
  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    return (
      this.pssyspfplugin ||
      (this.pssyspfplugin = this.fillObjectModel(
        S._27c,
        this.M.getPSSysPFPlugin,
        S._2a7,
      ) as IPSSysPFPlugin)
    );
  }

  get sampleData(): string {
    return this.M.sampleData;
  }

  get seriesField(): string {
    return this.M.seriesField;
  }

  get seriesLayoutBy(): string {
    return this.M.seriesLayoutBy;
  }

  protected seriespscodelist: IPSAppCodeList;
  getSeriesPSCodeList(): IPSAppCodeList | null {
    return (
      this.seriespscodelist ||
      (this.seriespscodelist = this.fillObjectModel(
        S._8,
        this.M.getSeriesPSCodeList,
        S._313,
      ) as IPSAppCodeList)
    );
  }

  get seriesType():
    | 'area'
    | 'bar'
    | 'bar3d'
    | 'candlestick'
    | 'gauge'
    | 'line'
    | 'pie'
    | 'pie3d'
    | 'radar'
    | 'scatter'
    | 'column'
    | 'funnel'
    | 'map'
    | 'custom' {
    return this.M.seriesType;
  }

  get tagField(): string {
    return this.M.tagField;
  }

  get valueField(): string {
    return this.M.valueField;
  }

  get enableChartDataSet(): boolean {
    return this.M.enableChartDataSet;
  }
  get cls(): string {
    return 'PSDEChartSeriesImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._119) return true;
    return super.instanceof(cls);
  }
}
